home *** CD-ROM | disk | FTP | other *** search
- /*
- (C) 1995-96 AROS - The Amiga Replacement OS
- $Id: modifyidcmp.c,v 1.3 1996/08/29 13:33:31 digulla Exp $
- $Log: modifyidcmp.c,v $
- Revision 1.3 1996/08/29 13:33:31 digulla
- Moved common code from driver to Intuition
- More docs
-
- Revision 1.2 1996/08/23 17:25:30 digulla
- Added include intuition/intuition.h to user-docs
-
- Revision 1.1 1996/08/13 15:37:27 digulla
- First function for intuition.library
-
-
- Desc:
- Lang: english
- */
- #include "intuition_intern.h"
- #include <clib/exec_protos.h>
-
- /*****************************************************************************
-
- NAME */
- #include <intuition/intuition.h>
- #include <clib/intuition_protos.h>
-
- __AROS_LH2(BOOL, ModifyIDCMP,
-
- /* SYNOPSIS */
- __AROS_LHA(struct Window *, window, A0),
- __AROS_LHA(unsigned long , flags, D0),
-
- /* LOCATION */
- struct IntuitionBase *, IntuitionBase, 25, Intuition)
-
- /* FUNCTION
- This routine modifies the state of your window's IDCMP (Intuition
- Direct Communication Message Port).
-
- Depending on the current state in the IDCMPFlags of the window and
- the specified flags these actions are possible:
-
- IDCMP flags Action
- 0 0 Nothing happens
- 0 !=0 The flags are copied in the IDCMPFlags of the window
- and a MessagePort is created and stored in the
- UserPort of the window.
- !=0 0 The IDCMPFlags are cleared and the MessagePort in the
- UserPort is deleted.
- !=0 !=0 The flags are copied to the IDCMPFlags of the
- window.
-
- INPUTS
- window - The window to change the IDCMPFlags in.
- flags - New flags for the IDCMPFlags of the window. See
- intuition/intuition.h for the available flags.
-
- RESULT
- TRUE if the change could be made and FALSE otherwise.
-
- NOTES
- You can set up the Window->UserPort to any port of your own
- before you call ModifyIDCMP(). If IDCMPFlags is non-null but
- your UserPort is already initialized, Intuition will assume that
- it's a valid port with task and signal data preset and Intuition
- won't disturb your set-up at all, Intuition will just allocate
- the Intuition message port half of it. The converse is true
- as well: if UserPort is NULL when you call here with
- IDCMPFlags == NULL, Intuition will deallocate only the Intuition
- side of the port.
-
- This allows you to use a port that you already have allocated:
-
- - OpenWindow() with IDCMPFlags equal to NULL (open no ports)
- - set the UserPort variable of your window to any valid port of your
- own choosing
- - call ModifyIDCMP with IDCMPFlags set to what you want
- - then, to clean up later, set UserPort equal to NULL before calling
- CloseWindow() (leave IDCMPFlags alone) BUT FIRST: you must make
- sure that no messages sent your window are queued at the port,
- since they will be returned to the memory free pool.
-
- For an example of how to close a window with a shared IDCMP,
- see the description for CloseWindow().
-
- EXAMPLE
-
- BUGS
-
- SEE ALSO
- OpenWindow(), CloseWindow()
-
- INTERNALS
-
- HISTORY
- 29-10-95 digulla automatically created from
- intuition_lib.fd and clib/intuition_protos.h
-
- *****************************************************************************/
- {
- __AROS_FUNC_INIT
- __AROS_BASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
-
- if (!window->IDCMPFlags && flags)
- {
- window->UserPort = CreateMsgPort ();
-
- if (!window->UserPort)
- return FALSE;
- }
-
- window->IDCMPFlags = flags;
-
- if (!flags)
- {
- if (window->UserPort)
- {
- DeleteMsgPort (window->UserPort);
- window->UserPort = NULL;
- }
- }
-
- return TRUE;
- __AROS_FUNC_EXIT
- } /* ModifyIDCMP */
-